﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace chat
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
            int a;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //Online f = new Online();
            //f.el += f_el;
            //f.Show();
            //this.Hide();


            HeroDataSetTableAdapters.UserTableAdapter a = new HeroDataSetTableAdapters.UserTableAdapter();
            DataTable User = a.GetData();
            //MessageBox.Show(User.Columns[.ToString());
            HeroDataSet.UserDataTable b = new HeroDataSet.UserDataTable();
            a.Fill(b);
            String name = textBox1.Text;
            String pass = textBox2.Text;
            for (int i = 0; i < b.Rows.Count; i++)
            {
                
                if (name.CompareTo(b.Rows[i][1]) == -1 && pass.CompareTo(b.Rows[i][2])==-1)
                    //MessageBox.Show("crect name");
                {
                    Online f = new Online(name);
                    f.el += f_el;
                    f.Show();
                    this.Hide();
                }
                else
                    MessageBox.Show("wrong name");
                
            }
        }

        void f_el(object sender, Online.thoatLogin e)
        {
            this.Show();
        }

        private void Login_Load(object sender, EventArgs e)
        {

            
        }
        
    }
}
